﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPF.Core.Dtos;
using WPF.Core.Models;

namespace WPF.Core.Services
{
    /// <summary>
    /// 待办事项服务
    /// </summary>
    public class ToDoService : BaseService<ToDoModel, ToDo>, IToDoService
    {
        public async Task<List<ToDoModel>> GetAll(ToDoPagingInfo pageing)
        {
            var models = await Sqlite.Select<ToDo>()
                .Where(q => q.Title.Contains(pageing.Name))
                .Count(out long Count) //总记录数量
                .Page(pageing.PageNumber, pageing.PageSize)
                .ToListAsync();
            pageing.Count = Count;
            return mapper.Map<List<ToDoModel>>(models);
        }
    }
}
